var add = document.querySelector(".aa")
//	获取input内容
var ipt = document.querySelector('#ipt')
function de(){
	if(ipt.value != "") {

		//	创建li标签
		var li = document.createElement('li')
		li.className = "shijian"

		//	关于wc标签
		var xuanze = document.createElement("div")
		xuanze.className = 'xuanze'
		var wc = document.createElement("span")
		wc.className = "wc"
		xuanze.appendChild(wc)

		//	关于内容
		var neirong = document.createElement('div')
		neirong.className = "neirong"
		var nr = document.createElement('h3')
		nr.className = "nr"
		neirong.appendChild(nr)
		nr.innerHTML = ipt.value
		neirong.addEventListener('dblclick',function(){
			this.setAttribute('contenteditable',true)
		})

		//	关于删除
		var guanbi = document.createElement("div")
		guanbi.className = "guanbi"
		var cha = document.createElement("span")
		cha.className = "cha"
		guanbi.appendChild(cha)

		//	关于删除——删除功能
		guanbi.addEventListener("click", function() {
			var xia = document.querySelector('.xia')
			xia.removeChild(this.parentElement)
		})

		//	追加
		li.appendChild(xuanze)
		li.appendChild(neirong)
		li.appendChild(guanbi)

		var xia = document.querySelector('.xia')
		xia.insertBefore(li,xia.firstChild)

		ipt.value = ""
	} else {
		alert("请输出待办内容")
	}
}
add.addEventListener('click', function() {
	de()
})


document.onkeydown = function(e){
        var ev = document.all ? window.event : e;
        if(ev.keyCode==13) {
            de()
        }
    }